/*
#####################################################################
####################	   T R I B U I T 		#####################
#####################################################################

Copyright (C) 2010  Christoph Schnack, Berlin (Germany)

This file is part of Tribuit.

    Tribuit is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Tribuit is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tribuit.  If not, see <http://www.gnu.org/licenses/>.


########################################################################
*/
package OtherDialogs;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import GuiTools.GuiTools;
import GuiTools.TribuitFrame;
import Mainframe.Mainframe;
import Settings.Language;
import Settings.Settings;

/**
 * @author Christoph Schnack
 *
 */
/**
 * 
 * Creates a TribuitFrame showing information about Tribuit
 * 
 * @author Christoph Schnack
 *@see TribuitCanvas
 */

public class InfoFrame extends TribuitFrame{
	TribuitFrame frame = this;
	Settings SET;
	Language LANG;
	Mainframe MAINFRAME;
	public InfoFrame(Settings set, Mainframe mf){
		super("lj");
		SET=set;
		MAINFRAME=mf;
		LANG = SET.getLanguage();
		this.setTitle(LANG.getInfoTitle());
		JButton okBtn = new JButton(LANG.getClose());
		okBtn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				frame.dispose();
			}
		});
		JPanel btnPanel = new JPanel();
		btnPanel.add(okBtn);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.getContentPane().add(BorderLayout.CENTER,new TribuitInfoCanvas(LANG));
		this.getContentPane().add(BorderLayout.SOUTH,btnPanel);
		this.showUpAt(MAINFRAME);
		this.setVisible(true);
	}
	
	public class TribuitInfoCanvas extends JPanel{
		Language LANG;
		public TribuitInfoCanvas(Language lang){
			super();
			LANG = lang;
			
			JLabel title = new JLabel(LANG.getMayYouUnderstand());
			title.setForeground(Color.green);
			title.setOpaque(false);
			JPanel titlePanel = new JPanel();
			titlePanel.add(title);
			titlePanel.setBackground(Color.darkGray);
			
			JLabel head = new JLabel("Tribuit");
			head.setOpaque(false);
			head.setFont(new Font(Font.SERIF,Font.BOLD | Font.ROMAN_BASELINE,50));
			head.setForeground(Color.green);
			JPanel header = new JPanel();
			header.add(head);
			header.setBackground(Color.darkGray);
			
			
			JLabel version = new JLabel("Version: "+GuiTools.TRIBUITVERSION);
			//version.setForeground(Color.white);
			version.setOpaque(false);
			version.setFont(new Font(Font.SERIF,Font.BOLD | Font.ROMAN_BASELINE,18));
			
			Font f = new Font(Font.SERIF,Font.PLAIN,17);
			
			JLabel line1 = new JLabel("Tribuit is distributed under terms of GNU-GPL v3.");
			//line1.setForeground(Color.white);
			line1.setOpaque(false);
			line1.setFont(f);
			
			JLabel line2 = new JLabel("updates: http://sourceforge.net/projects/tribuit/");
			//line2.setForeground(Color.white);
			line2.setOpaque(false);
			line2.setFont(f);
			
			JLabel line3 = new JLabel(LANG.getInfoBugsTo());
			//line3.setForeground(Color.white);
			line3.setOpaque(false);
			line3.setFont(f);
			
			JLabel bottom = new JLabel(LANG.getInfoProduced());
			//bottom.setForeground(Color.white);
			bottom.setOpaque(false);
			bottom.setFont(new Font(Font.SERIF,Font.PLAIN,14));
			
			
			this.setLayout(new GridBagLayout());
			this.setBackground(Color.lightGray);
			GridBagConstraints ipGbc = new GridBagConstraints();
			ipGbc.anchor = GridBagConstraints.CENTER;
			ipGbc.weightx=1;
			ipGbc.fill=GridBagConstraints.BOTH;
			this.add(header,ipGbc);
			ipGbc.fill=GridBagConstraints.NONE;
			ipGbc.gridy=1;
			ipGbc.anchor = GridBagConstraints.NORTHWEST;
			ipGbc.insets = new Insets(20,30,20,30);
			this.add(version,ipGbc);
			ipGbc.insets = new Insets(0,30,5,30);
			ipGbc.gridy=2;
			this.add(line1,ipGbc);
			ipGbc.gridy=3;
			this.add(line2,ipGbc);
			ipGbc.gridy=4;
			this.add(line3,ipGbc);
			ipGbc.anchor = GridBagConstraints.CENTER;
			ipGbc.insets = new Insets(20,0,20,0);
			ipGbc.gridy=5;
			this.add(bottom,ipGbc);
			ipGbc.fill=GridBagConstraints.BOTH;
			ipGbc.insets = new Insets(0,0,0,0);
			ipGbc.gridy=6;
			this.add(titlePanel,ipGbc);
		}
	}
}
